<template>
  <el-form label-width="120px" class="container">
    <el-form-item label="邮箱" prop="email">
      <el-input
        type="email"
        v-model="email"
        placeholder="Enter Email..."
      ></el-input>
    </el-form-item>

    <el-form-item>
      <el-button
        type="primary"
        @click="handleForgotPassword()"
        class="submit-btn"
        >找回密码</el-button
      >
    </el-form-item>
  </el-form>
</template>
<script lang="ts">
import { ref, getCurrentInstance } from "vue";
import { useRouter } from "vue-router";
export default {
  setup() {
    // @ts-ignore
    const {proxy} = getCurrentInstance()
    const email = ref<string>("");
    const handleForgotPassword = async () => {
      // console.log(email.value);
      const res = await proxy.$axios.post("/api/v1/auth/forgotpassword",{email:email.value})
      console.log(res.data);
    };
    return {
      email,
      handleForgotPassword,
    };
  },
};
</script>
<style scoped>
.container {
  width: 50%;
  margin: 200px auto;
}

.submit-btn {
  width: 100%;
}
</style>